import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  if (window.localStorage) {
    return window.localStorage.getItem(TokenKey)
  } else {
    return Cookies.get(TokenKey)
  }
}

export function setToken(token) {
  if (window.localStorage) {
    return window.localStorage.setItem(TokenKey, token)
  } else {
    return Cookies.set(TokenKey, token)
  }
}

export function removeToken() {
  if (window.localStorage) {
    return window.localStorage.removeItem(TokenKey)
  } else {
    return Cookies.remove(TokenKey)
  }
}
